import 'package:flutter/material.dart';
import 'package:flutter_bilibili/core/extension/int_extension.dart';
import 'package:flutter_bilibili/ui/pages/publish/ready_2_publish_content.dart';
import 'package:flutter_bilibili/ui/shared/app_theme.dart';
import 'package:flutter_bilibili/ui/widgets/rectangle_checkBox.dart';

class HYReady2PublishScreen extends StatefulWidget {
  static const String routeName = "/ready_2_publish";

  @override
  State<HYReady2PublishScreen> createState() => _HYReady2PublishScreenState();
}

class _HYReady2PublishScreenState extends State<HYReady2PublishScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: .8,
        leading: Icon(
          Icons.arrow_back_rounded,
          size: 20.px,
          color: Colors.black,
        ),
      ),
      body: HYReady2PublishContent(),
      bottomNavigationBar: buildReady2PublishBottomWidget(),
    );
  }

  ///预发布界面底部
  Widget buildReady2PublishBottomWidget() {
    var _flag = true;
    return Container(
      color: Colors.white,
      padding: EdgeInsets.symmetric(vertical: 10.px, horizontal: 15.px),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisSize: MainAxisSize.min,
        children: [
          Text(
            "如存在商业合作，需电脑网页端投稿并进行商业声明",
            style: TextStyle(
                color: HYAppTheme.norGrayColor,
                fontSize: HYAppTheme.xxSmallFontSize),
          ),
          SizedBox(
            height: 8.px,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: [
              RectangleCheckBox(
                size: 13.px,
                checkedColor: HYAppTheme.norTextColors,
                isChecked: _flag,
                onTap: (value) {
                  setState(() {
                    _flag = value!;
                  });
                },
              ),
              SizedBox(
                width: 10.px,
              ),
              Text(
                "我已经阅读并接收",
                style: TextStyle(
                    color: Colors.black, fontSize: HYAppTheme.xxSmallFontSize),
              ),
              Text(
                "《哔哩哔哩创作公约》",
                style: TextStyle(
                    color: HYAppTheme.norTextColors,
                    fontSize: HYAppTheme.xxSmallFontSize),
              ),
            ],
          ),
          SizedBox(
            height: 8.px,
          ),
          Row(
            children: [
              Container(
                margin: EdgeInsets.symmetric(horizontal: 5.px),
                padding:
                    EdgeInsets.symmetric(vertical: 3.px, horizontal: 15.px),
                child: Image.asset(
                  "assets/image/icon/save_script.png",
                  width: 25.px,
                  height: 25.px,
                ),
                decoration: BoxDecoration(
                    border:
                        Border.all(color: HYAppTheme.norGrayColor, width: .2),
                    borderRadius: BorderRadius.all(Radius.circular(3.px))),
              ),
              Expanded(
                child: Container(
                  margin: EdgeInsets.symmetric(horizontal: 10.px),
                  child: TextButton(
                    onPressed: () {
                      ///点击发布
                    },
                    style: ButtonStyle(
                      backgroundColor:
                          MaterialStateProperty.all(HYAppTheme.norTextColors),
                    ),
                    child: Text(
                      "发布",
                      style: TextStyle(
                          color: Colors.white,
                          fontSize: HYAppTheme.xSmallFontSize),
                    ),
                  ),
                ),
              )
            ],
          )
        ],
      ),
    );
  }
}
